package com.wrupple.muba.common.shared;

import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.event.shared.EventBus;
import com.wrupple.muba.common.shared.State.Context;

public interface ServiceBus {
	
	public interface CommandService extends ScheduledCommand{

		void prepare(JavaScriptObject properties, EventBus eventBus,
				Context processContext, StateTransition<? extends JavaScriptObject> callback);
		
	}
	
	/**
	 * Adds support for a new {@link DesktopBlockCreator}
	 * 
	 * @param id
	 *            The new WidgetCreator id
	 * @param widgetCreator
	 *            the Widget Creator
	 */
	public void add(String id, CommandService commandService);

	/**
	 * Instantiates a new WIdget on run-time
	 * 
	 * @param id
	 *            id of the Widget Creator
	 * @return new Instance of the widget
	 */
	public CommandService get(String id);
	

	public void excecuteCommand(String command, JavaScriptObject properties,
			EventBus eventBus, Context processContext, StateTransition<? extends JavaScriptObject> callback);

}
